package com.wuchao.controller;


import com.wuchao.entity.Department;
import com.wuchao.response.Result;
import com.wuchao.service.DepartmentService;
import com.wuchao.vo.DepartmentVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wuchao
 * @since 2022-03-29
 */
@RestController
@RequestMapping("/department")
@CrossOrigin
public class DepartmentController {
    @Resource
    DepartmentService departmentService;
    @ApiOperation(value = "查找部门计数和名字")
    @GetMapping("/findDepartmentCountAndName")
    public Result  findDepartmentCountAndName(){
        List<DepartmentVO> departmentCountAndName = departmentService.findDepartmentCountAndName();
        return  Result.ok().data("departmentCountAndName",departmentCountAndName);
    }
}

